package 一维数组;

import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入学生的人数：");
        int studentNum=scanner.nextInt();
        int maxScore=0;
        int[] scores=new int[studentNum];
        System.out.println("请入学生的成绩：");
        for (int i = 0; i < scores.length; i++){
            scores[i]=scanner.nextInt();
            if (scores[i]>maxScore){
                maxScore=scores[i];
            }
        }
        System.out.println("最高分为"+maxScore);
        char grade=' ';
        for (int i = 0; i < scores.length; i++){
            if (scores[i]>=maxScore-10){
                grade='A';
            } else if (scores[i]>=maxScore-20){
                grade='B';
            }else if (scores[i]>=maxScore-30){
                    grade='C';
                }else {
                grade='D';
            }
            System.out.println("成绩为"+scores[i]+"等级为"+grade);
            }
        }
    }
